package com.study.spmongodb.wwj.thread.char06;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/6 10:28
 */
public class ThreadInterupt {
    public static void main(String[] args) throws InterruptedException {

        final Thread thread = new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(10);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    System.out.println("被打断了");
                    break;
                }
            }
        });

        thread.start();
        Thread.sleep(1000);
        System.out.println(thread.isInterrupted());
        thread.interrupt();
        System.out.println(thread.isInterrupted());

    }


}
